import Vue from 'vue'
import VueRouter from 'vue-router'

import Home from '@v/home/Home.vue'
import CityPicker from '@v/city/CityPicker.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    redirect: '/movie',
    children: [
      {
        path: 'movie',
        name: 'movie',
        component: () => import(/* webpacckChunkName: "movie" */ '@v/home/movies/Movies.vue'),
        redirect: '/movie/intheaters',
        children: [
          {
            path: 'intheaters',
            name: 'intheaters',
            component: () => import(/* webpackChunkName: "intheaters" */ '@v/home/movies/InTheaters.vue')
          },
          {
            path: 'comingsoon',
            name: 'comingsoon',
            component: () => import(/* webpackChunkName: "comingsoon" */ '@v/home/movies/ComingSoon.vue')
          }
        ]
      },
      {
        path: 'profile',
        name: 'profile',
        component: () => import(/* webpacckChunkName: "profile" */ '@v/home/profile/Profile.vue'),
      },
      {
        path: 'theaters',
        name: 'theaters',
        component: () => import(/* webpacckChunkName: "theaters" */ '@v/home/theaters/Theaters.vue'),
      }
    ]
  },
  {
    path: '/city',
    name: 'city',
    component: CityPicker
  }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router